package com.cmnit.gatherdata.enums;

/**
 * 原始流水Kafka Topic枚举定义
 * Created by Hehj
 */
public enum KafkaTopicEnum {

    // ETC收费门架流水数据（门架交易数据）
    GBUPLOAD_ETCTU_TOPIC("GBUPLOAD_ETCTU_TOPIC", "ETC收费门架流水数据"),

    // 出口车道流水
    TOLL_ORI_OUT_TRADE_TOPIC("TOLL_ORI_OUT_TRADE_TOPIC", "出口车道流水"),

    // 入口车道流水（车道入口车道数据）
    TRC_ENPU_TOPIC("TRC_ENPU_TOPIC", "入口车道流水"),

    // 合计topic
    ALL_TOPIC("TOLL_ORI_OUT_TRADE_TOPIC,TRC_ENPU_TOPIC,GBUPLOAD_ETCTU_TOPIC", "出入口车道流水"),

    // 去重后入口车道流水
    TOLL_FLOW_ENTRY("TOLL_FLOW_ENTRY", "入口车道流水数据"),

    // 去重后出口车道流水
    TOLL_FLOW_EXIT("TOLL_FLOW_EXIT", "出口车道流水数据"),

    // 去重后门架ETC交易数据
    GANTRY_CHARGE_ETC("GANTRY_CHARGE_ETC", "门架ETC交易数据");

    KafkaTopicEnum(String topic, String desc) {
        this.topic = topic;
        this.desc = desc;
    }

    //通过topic获取kafka枚举类
    public static KafkaTopicEnum getByTopic(String topic) {
        for (KafkaTopicEnum item : KafkaTopicEnum.values()) {
            if (topic.equals(item.getTopic())) {
                return item;
            }
        }
        return null;
    }


    /**
     * Kafka topic
     */
    private String topic;

    /**
     * 描述
     */
    private String desc;


    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
